package com.example.shopdemo.enums;

/**
 * @author ：Anitaxiaofeng
 * @description：
 * @create 2018-01-21
 **/
public enum ProductStateEnum {


    OFFINE(-1,"非法商品"),
    SUCCESS(0,"操作成功"),
    PASS(2,"通过认证"),
    INNER_ERROR(-1001,"操作失败"),
    EMPTY(-1002,"商品为空");

    private int key;
    private String value;

    private ProductStateEnum(int key,String value){
        this.key = key;
        this.value = value;
    }

    public int getKey(){
        return key;
    }

    public String getValue(){
        return value;
    }

    public static ProductStateEnum stateOf(int index){
        for(ProductStateEnum state : values()){
            if(state.getKey()==index){
                return state;
            }
        }
        return null;
    }
}
